# 第一阶段：构建项目并下载依赖
FROM maven:3.8.8-openjdk-21 AS builder
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline -B
COPY src ./src
RUN mvn package -DskipTests

# 第二阶段：运行镜像
FROM openjdk:21-jdk-slim
WORKDIR /app
COPY --from=builder /app/target/langchain4j_springboot-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 8080
CMD ["java", "-jar", "app.jar"]